<template>
  <page-body>
    <view class="page">
      <view class="flex benben-position-layout flex flex-wrap align-center subscribeList_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub subscribeList_fd0_0'>
          <view class='flex flex-wrap align-center subscribeList_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  subscribeList_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='subscribeList_fd0_0_c1_c0'>今日分配</text>
          </view>
          <view class='flex flex-wrap align-center justify-end subscribeList_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <!-- <view class="flex benben-flex-layout flex-wrap align-center">
        <view>
          <benben-flex-tabs class-name='subscribeList_benbenTabsfd1_0' v-model="cateId" ref="benben_tabsfd1_0"
            select-mark="benben_tabsfd1_0" key="benben_tabsfd1_0" :open-title-type='false' :open-sticky='false' :top='0'
            :is-show-content='false' :scrollspy='false' :tabs-info.sync="tabsInfofd1_0" @change="getListFunc()">

            <scroll-view @scroll="tabsInfofd1_0.scrollX = $event.detail.scrollLeft" id="benben_tabsfd1_0"
              class="benben-tabs" style="width:686rpx;margin:0 auto" :scroll-x="true"
              :scroll-left.sync="tabsInfofd1_0.moveX" scroll-with-animation="all .3s ease">
              <view class="benben-tabs-content" id="benben_tabsfd1_0-content" style="width:686rpx;margin:0 auto;">
                <view id="benben_tabsfd1_0-title" class="benben-tabs-title flex flex align-center justify-around">
                  <view :class="{ 'checkTitlefd1_0': cateId == '1', 'flex flex-wrap align-center': true }"
                    @tap="cateId = '1'" :id="`benben_tabsfd1_0-title-item-${'1'}`">

                    <text>待分配</text>

                  </view>
                  <view :class="{ 'checkTitlefd1_0': cateId == '2', 'flex flex-wrap align-center': true }"
                    @tap="cateId = '2'" :id="`benben_tabsfd1_0-title-item-${'2'}`">

                    <text>已分配</text>

                  </view>
                </view>
                <view :style="{ left: tabsInfofd1_0.lineleft, maxWidth: tabsInfofd1_0.lineWidth ,}"
                  id="benben_tabsfd1_0-line"
                  class="benben-tabs-line flex benben-flex-tabs-line subscribeList_linefd1_0"></view>
              </view>
            </scroll-view>

          </benben-flex-tabs>

        </view>
      </view> -->

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <!-- <view class="flex flex-direction align-stretch benben-flex-layout">
        <view class='flex align-center subscribeList_fd2_0'>
          <view class='flex flex-wrap align-center'>
            <text class='subscribeList_fd2_0_c0_c0'>预约时间</text>
          </view>
          <view class='flex flex-wrap align-center subscribeList_fd2_0_c1' @tap.stop="isShow=true">
            <image class='subscribeList_fd2_0_c1_c0' mode="aspectFit" :src='STATIC_URL+"160.png"'></image>
            <text>{{start_data ||'开始时间'}} <text class="margin-lr-lg text-333">至</text> {{end_data || '结束时间'}}</text>
          </view>
        </view>
        <view class='flex flex-wrap align-center self-center subscribeList_fd2_1'>
          <image class='subscribeList_fd2_1_c0' mode="aspectFit" :src='STATIC_URL+"159.png"'></image>
          <text class='subscribeList_fd2_1_c1'>客户数量</text>
          <text class='subscribeList_fd2_1_c2'>{{total}}</text>
        </view>
      </view> -->

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <template v-for='(item,flex3) in dataList'>
        <view class="flex flex-direction align-stretch benben-flex-layout subscribeList_flex_3" :key='flex3'>
          <view class='flex flex-wrap align-center justify-between subscribeList_fd3_0'>
            <image class='subscribeList_fd3_0_c0' mode="aspectFit" :src='STATIC_URL+"151.png"'></image>
            <view class='flex flex-direction align-stretch flex-sub subscribeList_fd3_0_c1'>
              <view class='flex flex-wrap align-center subscribeList_fd3_0_c1'>
                <text>{{item.customerinfo_customer_name}}</text>
                <!-- <image class='subscribeList_fd3_0_c1_c0_c1' mode="aspectFit" :src='STATIC_URL+"155.png"'></image> -->
              </view>
              <view class='flex flex-wrap align-center subscribeList_fd3_0_c1_c1'>
                <text>{{item.customerinfo_customer_phone}}</text>
              </view>
            </view>
            <button class='subscribeList_fd3_0_c2' @tap.stop="handleJumpDiy" data-type="navigateTo"
              :data-url="`/pages/grzx/selectSales/selectSales?aid=${item.c_aid}`"
              v-if="item.distribution_status==1">移交</button>
          </view>
          <view class="padding-bottom-sm">
            <view class='flex flex-wrap align-end subscribeList_fd3_1'>
              <text class='subscribeList_fd3_1_c0'>{{item.customerinfo_customer_type_name}}日期</text>
              <text class="text-666">{{item.customerinfo_date_time}}</text>
            </view>
            <view class='flex flex-wrap align-end subscribeList_fd3_1'>
              <text class='subscribeList_fd3_1_c0'>预约日期</text>
              <text class="text-666">{{item.appointment_date}}</text>
            </view>
            <view class='flex flex-wrap align-center subscribeList_fd3_1'>
              <text class='subscribeList_fd3_1_c0'>预约时段</text>
              <text class='subscribeList_fd3_3_c1'>{{item.time_period_name}}</text>
            </view>
            <view class='flex flex-wrap align-end subscribeList_fd3_1' v-if="item.time_str">
              <text class='subscribeList_fd3_1_c0'>预约时间</text>
              <text class="text-666">{{item.time_str}}</text>
            </view>
            <view class='flex flex-wrap align-end subscribeList_fd3_1'>
              <text class='subscribeList_fd3_1_c0'>试衣间</text>
              <text class="text-666">{{item.fittingroom_name}}</text>
            </view>
            <view class='flex flex-wrap align-end subscribeList_fd3_1' v-if="item.distribution_status==2">
              <text class='subscribeList_fd3_1_c0'>负责销售</text>
              <view class='flex flex-wrap align-center'>
                <image class='subscribeList_fd3_6_c1_c0' mode="aspectFit" :src='item.sell_info.avatar'></image>
                <text class='subscribeList_fd3_6_c1_c1'>{{item.sell_info.nickname}}</text>
                <text>{{item.sell_info.mobile}}</text>
              </view>
            </view>
          </view>
          <view class='flex flex-wrap align-center justify-end btns'>
            <button class='self-end customers_fd3_2_c0' @tap.stop="handleJumpDiy" data-type="navigateTo"
              :data-url="`/pages/grzx/newCustomer/newCustomer?aid=${item.c_aid}`">客户类型</button>
            <button class='self-end customers_fd3_2_c3' @tap.stop="handleJumpDiy" data-type="navigateTo"
              :data-url="`/pages/grzx/newfollowup/newfollowup?aid=${item.c_aid}`">添加跟进</button>
          </view>
        </view>
      </template>
      <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
        :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
      <!---flex布局flex布局结束-->
      <!-- 日历弹框 start -->
      <fu-popup v-model="isShow" mode="center" :mask-close-able="true" @close="closePopup">
        <view class="calendar-box">
          <fu-calendar @change="change" active-bg-color="#F9E4C3" range-bg-color="#f9e4c34d" :future="true"
            start-text="" end-text="" mode="range" :isDefaultDay="false" :start-time="start_data"
            :end-time="end_data"></fu-calendar>
          <view @click="clearTime" class=" text-df padding-bottom-sm" style="text-align: center;color:#333333">清空</view>
        </view>
      </fu-popup>
      <!-- 日历弹框 end -->


    </view>
  </page-body>
</template>
<script>
  function getDate(date, AddDayCount = 0) {
    if (!date) {
      date = new Date()
    }
    if (typeof date !== 'object') {
      date = date.replace(/-/g, '/')
    }
    const dd = new Date(date)

    dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期

    const y = dd.getFullYear()
    const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期，不足10补0
    const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号，不足10补0
    return {
      fullDate: y + '-' + m + '-' + d,
      year: y,
      month: m,
      date: d,
      day: dd.getDay()
    }
  }
  import pagingList from '@/common/mixin/paging_list.js';
  export default {
    components: {},
    mixins: [pagingList],


    data() {
      return {
        start_data: '',
        end_data: '',
        isShow: false,
        "pickerDiy1719213466136": false,
        "tabsInfofd1_0": {
          lineleft: '',
          lineWidth: '',
          moveX: 0,
          scrollX: 0,
          PageScrollX: 0
        },
        "minixPagingListsApi": "",
        "pageingListApiMethod": "",
        "allowOnloadGetList": false,
        "dataList": [],
        "times": "",
        "cateId": "1",
        total: 0
      };
    },
    computed: {

    },
    watch: {},
    onLoad(options) {
      if (options.riqi) {
        this.start_data = options.riqi
        this.end_data = options.riqi
      } else {
        let rrqi = getDate(new Date().fullDate).fullDate
        this.start_data = rrqi
        this.end_data = rrqi
        console.log('rrqi', rrqi)
      }
      // this.getListFunc()


    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

      this.getListFunc()
    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      clearTime() {
        this.end_data = ''
        this.start_data = ''
        this.isShow = false;
        this.getListFunc()
      },
      change(value) {
        if (value.isInit) return;
        this.end_data = value.end
        this.start_data = value.start
        this.isShow = false;
        this.getListFunc()
      },
      closePopup() {
        this.isShow = false;
        this.getListFunc()
      },
      getTotal() {

        let appointment_date = ''
        if (this.end_data) {
          appointment_date = this.start_data + ' - ' + this.end_data
        }
        this.$api.post(global.apiUrls.post669dd5d4630a9, {
          appointment_date: appointment_date,
        }).then(res => {
          if (res.data.code == 1) {
            this.total = res.data.data.total
          }
        })
      },
      getListFunc() {
        this.getTotal()
        let appointment_date = ''
        if (this.end_data) {
          appointment_date = this.start_data + ' - ' + this.end_data
        }
        this.minixPagingListsApi = global.apiUrls.post669dd5d4630a9;
        this.pageingListApiMethod = 'post';
        this.allowOnloadGetList = false;
        this.pagingListPostDataContent = {
          appointment_date: appointment_date,
        }
        this.listData = [];
        this.dataList = this.listData;
        this.pagingListToggle();

      },
      pagingListPostData() {
        return this.pagingListPostDataContent
      },
    }
  };
</script>
<style lang="scss" scoped>
  .btns {
    border-top: 1rpx solid #EEEEEE;
  }

  .customers_fd3_2_c3 {
    background: #F9E4C3;
    border-radius: 8rpx 8rpx 8rpx 8rpx;
    width: 200rpx;
    line-height: 72rpx;
    font-size: 28rpx;
    color: var(--benbenFontColor0);
    height: 72rpx;
    margin: 24rpx 0rpx 0rpx 0rpx;
  }

  .customers_fd3_2_c0 {
    background: rgba(228, 195, 145, 0.3);
    border-radius: 8rpx 8rpx 8rpx 8rpx;
    width: 200rpx;
    line-height: 72rpx;
    font-size: 28rpx;
    color: var(--benbenFontColor0);
    height: 72rpx;
    margin: 24rpx 16rpx 0rpx 0rpx;
  }

  // 日历弹框 start
  .calendar-box {
    background: #FFF;
    border-radius: 16rpx;
    width: 640rpx;
    padding: 0 24rpx;
    border: 1px solid transparent;
  }

  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(255, 248, 238, 1);
    background-size: 100% auto;
    padding-bottom: 32rpx;
  }

  .subscribeList_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .subscribeList_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333333;
    line-height: 50rpx;
  }

  .subscribeList_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .subscribeList_fd0_0_c0 {
    width: 120rpx;
  }

  .subscribeList_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .subscribeList_linefd1_0 {
    background: rgba(249, 228, 195, 1);
    width: 50rpx;
    height: 8rpx;
    top: 80rpx;
    background-size: 100% auto !important;
    border-radius: 16rpx;
  }

  .checkTitlefd1_0 {
    // width: 200rpx;
    // text-align: center;

    font-weight: 700 !important;
    font-size: 28rpx !important;
    color: #333 !important;
    background-color: rgba(255, 255, 255, 1) !important;
  }

  ::v-deep .subscribeList_benbenTabsfd1_0 {
    background: #fff;
    width: 750rpx;
    height: 90rpx;
    white-space: nowrap;
    text-align: center;
  }

  .subscribeList_fd2_1_c2 {
    font-size: 34rpx;
    font-weight: 600;
    transform: translateY(2rpx);
  }

  .subscribeList_fd2_1_c1 {
    margin: 0rpx 24rpx 0rpx 24rpx;
  }

  .subscribeList_fd2_1_c0 {
    width: 14rpx;
    height: 30rpx;
    margin: 0rpx 0rpx 0rpx 24rpx;
  }

  .subscribeList_fd2_1 {
    background: #FFFFFF;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
    width: 686rpx;
    height: 80rpx;
    margin: 0rpx auto 0rpx auto;
  }

  .subscribeList_fd2_0_c1_c0 {
    width: 29rpx;
    height: 29rpx;
    margin: 0rpx 16rpx 0rpx 16rpx;
  }

  .subscribeList_fd2_0_c1 {
    background: #FFFFFF;
    border-radius: 8rpx 8rpx 8rpx 8rpx;
    width: 500rpx;
    height: 56rpx;
    color: rgba(170, 170, 170, 1);
  }

  .subscribeList_fd2_0_c0_c0 {
    width: 180rpx;
  }

  .subscribeList_fd2_0 {
    width: 686rpx;
    margin: 24rpx auto 24rpx auto;
  }

  .subscribeList_flex_3 {
    background: rgba(255, 255, 255, 1);
    margin: 26rpx 24rpx 0rpx 24rpx;
    padding: 24rpx;
    border-radius: 26rpx;
    background-size: 100% auto;
  }

  .subscribeList_fd3_6_c1_c1 {
    margin: 0rpx 32rpx 0rpx 24rpx;
  }

  .subscribeList_fd3_6_c1_c0 {
    width: 40rpx;
    height: 40rpx;
    border-radius: 100rpx;
  }

  .subscribeList_fd3_3_c1 {
    background: rgba(255, 248, 238, 1);
    background-size: 100% auto;
    border-radius: 8rpx;
    padding: 8rpx 8rpx 8rpx 8rpx;
    color: #666666;
  }

  .subscribeList_fd3_1_c0 {
    color: rgba(170, 170, 170, 1);
    width: 150rpx;
  }

  .subscribeList_fd3_1 {
    padding: 24rpx 0rpx 0rpx 0rpx;
    font-size: 28rpx;
  }

  .subscribeList_fd3_0_c2 {
    background: #F9E4C3;
    border-radius: 8rpx 8rpx 8rpx 8rpx;
    width: 136rpx;
    line-height: 60rpx;
    font-size: 24rpx;
    color: var(--benbenFontColor0);
    height: 56rpx;
  }

  .subscribeList_fd3_0_c1_c1 {
    margin: 16rpx 0rpx 0rpx 0rpx;
  }

  .subscribeList_fd3_0_c1_c0_c1 {
    width: 115rpx;
    height: 34rpx;
    margin: 0rpx 0rpx 0rpx 16rpx;
  }

  .subscribeList_fd3_0_c1 {
    font-size: 32rpx;
    font-weight: 600;
  }

  .subscribeList_fd3_0_c0 {
    width: 62rpx;
    height: 67rpx;
    margin: 0rpx 24rpx 0rpx 0rpx;
  }

  .subscribeList_fd3_0 {
    border-bottom: 1px solid #eee;
    padding: 0rpx 0rpx 24rpx 0rpx;
  }

  .subscribeList_picker4_0_c2 {
    color: rgba(211, 152, 80, 1);
  }

  .subscribeList_picker4_0 {
    border-bottom: 1px solid #eee;
    background: #fff;
    padding: 0rpx 32rpx 0rpx 32rpx;
    line-height: 88rpx;
    border-radius: 25rpx 25rpx 0rpx 0rpx;
    background-size: 100% auto !important;
  }
</style>
